<template>
  <view>
    <orderdetailsskeleton v-if="loading"></orderdetailsskeleton>
    <block v-else>
      <view class="statebox">
        <view class="state">
          {{
            orderdest.status == 'CONFIRM_COMPLETION' ? "已完成" : (orderdest.status == 'GENERATE_ORDER' ? "待支付" : (orderdest.status == 'PAYMENT_ORDER' ? '待送车' : (orderdest.status == 'USE_LOADING' ? '使用中' : (orderdest.status == 'CANCEL_ORDERS' ? '已取消' : (orderdest.status == 'RECEIVE_LOADING' ? '已还车' : (orderdest.status == 'ACCEPT_ORDERS' ? '已接单' : (orderdest.status == 7 ? '待还车' : (orderdest.status == 'USE_EXPIRE' ? '待收车' : (orderdest.status == 'ACCEPT_RETRIEVE_ORDERS' ? '已接单(还车)' : (orderdest.status == 'REJECT_ORDERS' ? '商家拒单' : orderdest.status == 'CREATE_ORDER' ? "待支付" : ""))))))))))
          }}
        </view>
        <view class="text">
          <text v-if="orderdest.status=='CANCEL_ORDERS'">你的订单已取消，感谢你使用将欲行租车</text>
          <text v-if="['GENERATE_ORDER','CREATE_ORDER'].includes(orderdest.status)">支付剩余时间：{{ timeLeft }}</text>
        </view>
      </view>
      <view class="backcolor-white border-radius20">
        <view class="contenitem ">
          <view class="top">
            <view class="fl">
              在线支付
              <text>￥{{ orderdest.totalMoney }}</text>
            </view>
            <view class="popper-lanse jump-text" @tap="tappopupfun('费用明细')">
              费用明细
            </view>
          </view>
          <view class="db">
            <view class="flex-x-between">
              <text>订单号</text>
              <view class="">
                <text style="margin: 0 10upx;">{{ orderdest.orderNum }}</text>
                <!-- <text style="color: #3366CC;" @tap="cop">复制</text> -->
                <uni-icons custom-prefix="iconfont" @tap.stop="cop" type="icon-copy" size="15"
                           color="#3366CC"></uni-icons>
              </view>
            </view>

            <view class="createtime flex-x-between" style="margin-top: 20upx;">
              <view class="">
                下单时间：
              </view>
              <view class="">
                {{ orderdest.createTime }}
              </view>
            </view>

            <view class="createtime flex-x-between" style="margin-top: 20upx;"
                  v-if="!['GENERATE_ORDER','CREATE_ORDER','CANCEL_ORDERS','REJECT_ORDERS'].includes(orderdest.status)">
              <view class="">
                合同状态：
              </view>
              <view class="">
                <text
                    v-if="['CONFIRM_COMPLETION','CANCEL_ORDERS','REJECT_ORDERS','CREATE_ORDER','GENERATE_ORDER'].includes(orderdest.status)">
                  <text v-if="orderdest.txFlowStatusInfo" @click="jumpPending" class="popper-lanse">
                    {{ orderdest.txFlowStatusInfo }}
                  </text>
                  <text v-else>
                    未签署合同
                  </text>
                </text>
                <text v-else-if="['INIT','PART','PENDING'].includes(orderdest.txFlowStatus)" @click="jumpPending"
                      class="popper-lanse">
                  待签署(点击签署合同)
                </text>
                <text v-else-if="orderdest.txFlowStatusInfo" @click="jumpPending" class="popper-lanse">
                  {{ orderdest.txFlowStatusInfo }}
                </text>
                <text v-else class="popper-lanse" @click="jumpInitContract">
                  未签署合同(点击签署合同)
                </text>
              </view>
            </view>
            <view style="margin-top: 20upx;height: 20upx"
                  v-if="orderdest.status=='GENERATE_ORDER'||orderdest.status=='CREATE_ORDER'">
              &nbsp;
              <text class="quxiao jump-text" @tap="quxiaoorder">取消订单</text>
            </view>
            <view style="margin-top: 20upx;height: 20upx"
                  v-if="(orderdest.status=='ACCEPT_ORDERS'&&!orderdest.orderpics)||orderdest.status=='ACCEPT_RETRIEVE_ORDERS'">

              &nbsp;<text class="quxiao jump-text" @tap="toCheckCode">识别码
            </text>
            </view>
          </view>

        </view>
        <!--        <view class="contenitem" @tap="tappopupfun('押金政策')">-->
        <!--          <view class="top">-->
        <!--            <view class="fl">-->
        <!--              押金-->
        <!--            </view>-->
        <!--            <view class="popper-lanse">-->
        <!--              押金政策-->
        <!--            </view>-->
        <!--          </view>-->
        <!--          <view class="db">-->
        <!--            取车时冻结/支付租车押金￥{{ orderdest.depositMoney ? orderdest.depositMoney : 0 }}，取车时冻结/支付违章押金¥{{-->
        <!--              orderdest.violationDeposit ? orderdest.violationDeposit : 0-->
        <!--            }}-->
        <!--          </view>-->
        <!--        </view>-->
        <view class="contenitem" v-if="orderdest.status=='CANCEL_ORDERS'" @tap="tappopupfun('取消政策')">
          <view class="" style="display: flex; justify-content: space-between;">
            <view class="text" style="font-size: 24upx;">
              订单已取消
            </view>
            <view class="popper-lanse jump-text">
              取消政策
            </view>
          </view>


        </view>

        <view class="kaishishiyong" style="align-items: center;float: none;"
              v-else-if="orderdest.status=='ACCEPT_ORDERS'">
          <view class="">
            <view class="fl">使用须知：</view>
            <view class="">
              待员工确认上传完成驾驶员身份证驾驶证照片等信息才可以使用
            </view>
          </view>
          <!--          <view class="">-->
          <!--            <button class="kaishi" @tap="kaishishiyong">开始使用</button>-->
          <!--          </view>-->


        </view>
        <view class="quchehou" style="align-items: center;" v-if="orderdest.status=='USE_LOADING'">
          <view class="">
            <view class="fl">
              用车提示：
            </view>
            <view class="text">
              用户开始用车后开始计时，租期到期后可选择续租或者还车！
            </view>
            <view v-if="orderdest.renewalCount" class="popper-lanse" style="margin-top: 10upx;" @tap="chakanxuzu">
              查看续租记录
            </view>
          </view>
          <view>
            <!--            <button type="default" style="margin-bottom: 20upx;" v-if="orderdest.pickUpMode==2"-->
            <!--                    @tap="huanche">上门还车-->
            <!--            </button>-->
            <button type="default" style="margin-bottom: 20upx;"
                    @tap="huanche">提前还车
            </button>
            <!-- <button type="default" style="margin-bottom: 20upx;" v-if="orderdest.pickUpMode==2"
              @tap="lianxiphone(orderdest.snatchPersonTel)">开始还车
            </button> -->

            <button type="primary" @tap="xuzu">续租用车</button>
          </view>

        </view>
      </view>

      <view class="backcolor-white">
        <view class="contenitem flex-x-center" style="justify-content: space-between">
          <view style="width: 100%;display: flex;">
            <view class="imglog" v-if="orderdest.carpic">
              <image style="width: 100%;height: 135rpx;" :src="imgurl+orderdest.carpic" mode=""></image>
            </view>
            <view class="conte" style="width: 100%">
              <view class="name">
                {{ orderdest.carName }}
              </view>
              <view class="xinhao" v-if="orderdest.vehicleParams">
                <text class="" v-for="(item,index) in orderdest.vehicleParams" :key="index" v-if="item">
                  {{ item }}
                  <text style="margin: 0 10upx;"
                        v-if="index !== orderdest.vehicleParams.length - 1">
                    /
                  </text>
                </text>
                <view class="popper-lanse jump-text" @tap="tappopupfun('车辆详情')">
                  车辆详情
                </view>
              </view>

            </view>
          </view>

          <!--          <view class="popper-lanse" @tap="tappopupfun('车辆详情')">-->
          <!--            车辆详情-->
          <!--          </view>-->
        </view>
        <view class="contenitem">
          <view class="time">
            {{ orderdest.startTime }} - {{ orderdest.endTime }} 共{{ orderdest.day }}天
          </view>
          <view class="addres-box">
            <view class="quche">
              <view class="flex-box-address">
                <view class="">
                  门店地址：
                  {{ orderdest.shopAddress }}
                  <text style="margin-left: 20rpx;color: #3366CC;"
                        @click="getaddres(orderdest.shopAddress,orderdest.shopLat,orderdest.shopLng)">导航
                  </text>
                </view>
              </view>
              <view class="" v-if="orderdest.snatchPersonName">
                送车员： {{ orderdest.snatchPersonName }}
              </view>
              <view class="" v-if="orderdest.snatchPersonTel">
                联系方式： {{ orderdest.snatchPersonTel }}

              </view>
              <view class="flex-box-address" v-if="orderdest.pickUpMode==2">
                <text
                    style=" background-color: #3366CC;" class="circle"></text>
                <text style="margin: 0 12upx;">取
                </text>
                <view class="address-box">送车上门：{{ orderdest.pickUpAddress }}</view>
                <text class="jump-text float-right-address"
                      @tap="getmendianaddres(0)"
                      v-if="['PAYMENT_ORDER','GENERATE_ORDER','CREATE_ORDER'].includes(orderdest.status)">修改地址
                </text>
              </view>
              <view class="flex-box-address"
                    v-if="['USE_EXPIRE'].includes(orderdest.status)">
                <text style="background-color: darkorange;" class="circle"></text>
                <text style="margin: 0 12upx;">还
                </text>
                <view class="address-box">上门取车：{{
                    orderdest.returnAddress ? orderdest.returnAddress : '待定'
                  }}
                </view>
                <text
                    class="float-right-address jump-text"
                    @tap="getmendianaddres(1)">修改地址
                </text>
              </view>
              <view class="" v-if="orderdest.collectorName">
                收车员： {{ orderdest.collectorName }}
              </view>
              <view class="" v-if="orderdest.collectorTel">
                联系方式： {{ orderdest.collectorTel }}
                <uni-icons type="phone" size="20" color="#3366cc" style="margin-left: 50upx;"
                           @tap="lianxiphone(orderdest.collectorTel)"></uni-icons>
              </view>
            </view>
            <!--            <view class="huanche" style="display: flex;"-->
            <!--                  v-if="!['GENERATE_ORDER','CREATE_ORDER','CANCEL_ORDERS'].includes(orderdest.status)">-->
            <!--              <view class="" style="height: 40upx; display: flex;align-items: center;">-->
            <!--                <text-->
            <!--                    style=" background-color: darkorange; width: 15upx;height: 15upx; border-radius: 50%;"></text>-->
            <!--                <text style="margin: 0 12upx;">还-->
            <!--                </text>-->
            <!--              </view>-->
            <!--              <view>-->
            <!--                <view class="" v-if="orderdest.pickUpMode==1">-->
            <!--                  &lt;!&ndash;                  <view class="">&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    前往{{ orderdest.shopName }}门店自行还车&ndash;&gt;-->
            <!--                  &lt;!&ndash;                  </view>&ndash;&gt;-->
            <!--                  <view class="" v-if="orderdest.bookEndTime">-->
            <!--                    预约还车时间：{{ orderdest.bookEndTime }}-->
            <!--                  </view>-->
            <!--                  <view class="" v-if="orderdest.collectorName">-->
            <!--                    接待员： {{ orderdest.collectorName }}-->
            <!--                  </view>-->
            <!--                  <view class="" v-if="orderdest.collectorTel">-->
            <!--                    联系方式： {{ orderdest.collectorTel }}-->
            <!--                    <uni-icons type="phone" size="20" color="#3366cc" style="margin-left: 50upx;"-->
            <!--                               @tap="lianxiphone(orderdest.collectorTel)"></uni-icons>-->

            <!--                  </view>-->
            <!--                  &lt;!&ndash;                  <view class="flex-x-center">&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    <text>地址：</text>&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    <text style="width: 420upx;" class="textellipsis">{{ orderdest.shopAddress }}&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    </text>&ndash;&gt;-->
            <!--                  &lt;!&ndash;                    <uni-icons style="margin-left: 30upx;" @tap="getmendianaddres" type="location"&ndash;&gt;-->
            <!--                  &lt;!&ndash;                               size="20" color="#3366cc"></uni-icons>&ndash;&gt;-->
            <!--                  &lt;!&ndash;                  </view>&ndash;&gt;-->
            <!--                </view>-->
            <!--                <view class="" v-if="orderdest.pickUpMode==2">-->
            <!--                  <view class="">-->
            <!--                    商家上门收车-->
            <!--                  </view>-->
            <!--                  <view class="" v-if="orderdest.bookEndTime">-->
            <!--                    预约还车时间：{{ orderdest.bookEndTime }}-->
            <!--                  </view>-->
            <!--                  <view class="" v-if="orderdest.collectorName">-->
            <!--                    收车员： {{ orderdest.collectorName }}-->
            <!--                  </view>-->
            <!--                  <view class="" v-if="orderdest.collectorTel">-->
            <!--                    联系方式： {{ orderdest.collectorTel }}-->
            <!--                    <uni-icons type="phone" size="20" color="#3366cc" style="margin-left: 50upx;"-->
            <!--                               @tap="lianxiphone(orderdest.collectorTel)"></uni-icons>-->

            <!--                  </view>-->
            <!--                  <view class="flex-x-center" v-if="orderdest.returnAddress">-->
            <!--                    <text>收车地址：</text>-->
            <!--                    <text style="width: 420upx;"-->
            <!--                          class="textellipsis">{{ JSON.parse(orderdest.returnAddress)[0] }}-->
            <!--                    </text>-->
            <!--                    &lt;!&ndash;                    <uni-icons style="margin-left: 50upx;" @tap="getaddres(orderdest.returnAddress)"&ndash;&gt;-->
            <!--                    &lt;!&ndash;                               type="location" size="20" color="#3366cc"></uni-icons>&ndash;&gt;-->
            <!--                    <text @tap="getaddres(orderdest.returnAddress)" style="margin-left: 50upx;">地址变更</text>-->
            <!--                  </view>-->
            <!--                </view>-->
            <!--              </view>-->
            <!--            </view>-->
          </view>
        </view>
      </view>

      <view class="backcolor-white">
        <!--        <view class="contenitem">-->
        <!--          <view class="top">-->
        <!--            <view class="fl">-->
        <!--              发票-->
        <!--            </view>-->
        <!--          </view>-->
        <!--          <view class="db">-->
        <!--            <text>如需发票，请在还车时联系门店索取</text>-->
        <!--          </view>-->

        <!--        </view>-->
        <view class="contenitem">
          <view class="mendianxinxi">
            <view class="title">
              {{ orderdest.shopName }}
            </view>
            <view class="phone" style="font-size: 26upx;margin-top: 20upx;width:192px;" v-if="orderdest.businessName">
              业务经理： {{ orderdest.businessName }}
            </view>
            <view class="phone" style="font-size: 26upx;margin-top: 20upx;width:192px;" v-if="orderdest.businessPhone">
              联系电话： {{ orderdest.businessPhone }}
              <uni-icons type="phone" :size="16" color="#3366cc" style="margin-left: 50upx;"
                         @tap="lianxiphone(orderdest.businessPhone)"></uni-icons>
            </view>
            <!--            <view class="phone" style="font-size: 26upx;margin-top: 20upx;">-->
            <!--              <text style="width:192px;">-->
            <!--                门店电话： {{ orderdest.shopTel }}-->
            <!--              </text>-->
            <!--              <uni-icons type="phone" size="20" color="#3366cc" class="jump-text"-->
            <!--                         @tap="lianxiphone(orderdest.shopTel)"></uni-icons>-->
            <!--            </view>-->

          </view>
        </view>
      </view>

      <!--      <view class="backcolor-white">-->
      <!--        <view class="contenitem">-->
      <!--          <view class="jiashiyuan">-->
      <!--            驾驶员信息-->
      <!--          </view>-->
      <!--          <view class="jiashiyuanbox">-->
      <!--            <view class="">-->
      <!--              <view class="label">-->
      <!--                驾驶员-->
      <!--              </view>-->
      <!--              <view class="text">-->
      <!--                {{ orderdest.driverName }}-->
      <!--              </view>-->
      <!--            </view>-->
      <!--            <view class="">-->
      <!--              <view class="label">-->
      <!--                证件-->
      <!--              </view>-->
      <!--              <view class="text">-->
      <!--                {{ orderdest.driverIdCard ? flitertext(orderdest.driverIdCard, 6, 4) : '无' }}-->
      <!--              </view>-->
      <!--            </view>-->
      <!--            <view class="">-->
      <!--              <view class="label">-->
      <!--                联系手机-->
      <!--              </view>-->
      <!--              <view class="text">-->
      <!--                {{ orderdest.driverPhone ? flitertext(orderdest.driverPhone, 4, 4) : '无' }}-->
      <!--              </view>-->
      <!--              <uni-icons type="phone" size="20" color="#3366cc" style="margin-left: auto;"-->
      <!--                         @tap="lianxiphone(orderdest.driverPhone)"></uni-icons>-->
      <!--            </view>-->
      <!--          </view>-->
      <!--        </view>-->
      <!--        <view class="jiashiyuantext">-->
      <!--          凭驾驶员本人有效身份证+中国大陆驾驶证取车-->
      <!--        </view>-->
      <!--      </view>-->
      <!--      <view class="backcolor-white" v-if="violationInfo!=undefined">-->
      <!--        <view v-for="item in violationInfo">-->
      <!--          <view class="contenitem">-->
      <!--            <view class="top">-->
      <!--              <view class="title">-->
      <!--                违章信息-->
      <!--              </view>-->
      <!--            </view>-->
      <!--            <view class="db">-->
      <!--              <text>违章原因：{{ item.vehViolationDesc }}</text>-->
      <!--            </view>-->
      <!--          </view>-->
      <!--          <view class="contenitem">-->
      <!--            <uni-row>-->
      <!--              <uni-col :span="10">-->
      <!--                &lt;!&ndash;            <image style="width: 100%;height: 100%;" :src="imgurl+violationInfo.vehViolationPics" mode=""></image>&ndash;&gt;-->
      <!--                <view class="violation">-->
      <!--                  <uni-swiper-dot :current="current" field="content" mode="nav" :dots-styles="dotsStyles">-->
      <!--                    <swiper class="swiper-box">-->
      <!--                      <swiper-item v-for="(url ,index) in imageSplit(item.vehViolationPics)" :key="index">-->
      <!--                        <ImagePreview :image="url" :url="imgurl"></ImagePreview>-->
      <!--                      </swiper-item>-->
      <!--                    </swiper>-->
      <!--                  </uni-swiper-dot>-->
      <!--                </view>-->
      <!--              </uni-col>-->
      <!--              <uni-col :span="10" :offset="2" v-if="item.remark">-->
      <!--                <view>-->
      <!--                  备注信息-->
      <!--                </view>-->
      <!--                <view class="xinhao">-->
      <!--                  {{ item.remark }}-->
      <!--                </view>-->
      <!--              </uni-col>-->
      <!--            </uni-row>-->
      <!--          </view>-->
      <!--        </view>-->
      <!--      </view>-->
    </block>
    <view style="height: 100rpx">
      <button class="weixinzhifu" type="primary" @tap="subimtorder"
              v-if="orderdest.status=='GENERATE_ORDER'||orderdest.status=='CREATE_ORDER'">去支付
      </button>
    </view>
    <uni-popup ref="tappopup" type="bottom" background-color="rgba(0,0,0,0)">
      <view class="popup-content">
        <view class="tabtop">

          <uni-icons type="closeempty" size="20" style="" @tap="$refs.tappopup.close()"></uni-icons>
          <view class="tit">
            {{ popuptext == "车辆详情" ? orderdest.carName : popuptext }}
          </view>
        </view>
        <view class="content " style="padding: 0 20upx 40upx 30upx;" v-if="popuptext=='费用明细'">
          <!-- 费用明细暂未开发 -->
          <view class="fyitem">
            <view class="title">
              <text>车辆租金</text>
              <text style="margin-left: 30upx;">日均￥{{ orderdest.money }}</text>
            </view>
            <view class="conte">
              <view class="fybox">
                <view class="fy">
                  <text>租车费</text>
                  <text>￥{{ (orderdest.money * orderdest.day).toFixed(2) }}</text>
                </view>
                <text></text>
              </view>
            </view>
          </view>
          <view class="fyitem">
            <view class="title">
              <text>车行手续费</text>
            </view>
            <view class="conte">
              <view class="fybox">
                <view class="fy">
                  <text>车行手续费</text>
                  <text>￥{{ orderdest.fee }}</text>
                </view>
                <text class="text">(含车辆清洁、单据打印等)</text>
              </view>
            </view>
          </view>
          <view class="fyitem">
            <view class="title">
              <text>车行保障服务费</text>
            </view>
            <view class="conte">
              <view class="fybox">
                <view class="fy">
                  <text>基础服务费</text>
                  <text>￥{{ orderdest.serviceFee }}</text>
                </view>
                <view class="fy" v-if="orderdest.pickUpMode==2">
                  <text>送车服务费</text>
                  <text>￥{{ orderdest.sendServiceFee }}</text>
                </view>
                <view class="fy" v-if="orderdest.openZxService==1">
                  <text>尊享服务费</text>
                  <text>￥{{ orderdest.zxServiceFee }}</text>
                </view>
                <text class="text">车辆保障赔付全部损失，含玻璃、不含车轮，车损5000元以下免收折扣费，停运费正常收取</text>
              </view>

            </view>
          </view>
          <view class="fyitem" v-if="orderdest.depositWay==1&&orderdest.payType==1">
            <view class="title">
              <text>车辆押金/违章押金</text>
            </view>
            <view class="conte">

              <view class="fybox">
                <view class="fy">
                  <text>租车押金</text>
                  <view :class="[orderdest.isReturnVehDeposit==1?'shanchu':'']">
                    <text class="price">￥{{ orderdest.depositMoney ? orderdest.depositMoney : 0 }}</text>
                    <text>{{ orderdest.isReturnVehDeposit == 1 ? '已退' : '' }}</text>
                  </view>
                </view>
                <view class="fy">
                  <text>违章押金</text>
                  <view :class="[orderdest.isReturnVioDeposit==1?'shanchu':'']">
                    <text class="price">￥{{ orderdest.violationDeposit ? orderdest.violationDeposit : 0 }}</text>
                    <text>{{ orderdest.isReturnVioDeposit == 1 ? '已退' : '' }}</text>
                  </view>
                </view>
                <text class="text">线上支付押金，用车完成后可退</text>
              </view>
            </view>
          </view>
          <view class="fyitemdb">
            <view class="ddje">
              订单总额
              <text style="color: red;margin-left: 10upx;">
                <text style="font-size: 24upx;">￥
                </text>
                {{ orderdest.totalMoney || orderdest.prepayMoney }}
              </text>
            </view>
            <view class="text">在线支付</view>
            <view style="height: 80rpx">
              <button class="weixinzhifu" type="primary" @tap="subimtorder"
                      v-if="orderdest.status=='GENERATE_ORDER'||orderdest.status=='CREATE_ORDER'">去支付
              </button>
            </view>
          </view>
        </view>
        <view class="content" style="padding: 0 20upx 40upx 30upx;" v-else-if="popuptext=='押金政策'">
          <!-- 押金政策暂未开发 -->
          <view class="title">
            {{
              orderdest.depositWay == 0 ? '此订单支持免押' : (orderdest.depositWay == 1 && orderdest.payType == 1 ? '你已线上支付押金' : (orderdest.depositWay == 1 && orderdest.payType == 2 ? '你已选择到店付押金' : ''))
            }}
          </view>
          <view class="table" style="margin: 30upx 0;">
            <uni-table stripe emptyText="暂无更多数据" border>
              <!-- <uni-tr>
              <uni-th align="center">租车押金</uni-th>
              <uni-th align="center">租车押金</uni-th>
            </uni-tr> -->
              <uni-tr>
                <uni-td>租车押金</uni-td>
                <uni-td>
                  <text :class="[orderdest.depositWay==0?'shanchu':'']"
                        style="margin-right: 10upx;">￥{{ orderdest.depositMoney ? orderdest.depositMoney : 0 }}
                  </text>
                  <text style="color: #43c900;" v-if="orderdest.depositWay==0">到店验证成功后免收</text>
                  <text v-else>可退
                  </text>
                </uni-td>
              </uni-tr>
              <uni-tr>
                <uni-td>违章押金</uni-td>
                <uni-td>
                  <text :class="[orderdest.depositWay==0?'shanchu':'']"
                        style="margin-right: 10upx;">￥{{ orderdest.violationDeposit ? orderdest.violationDeposit : 0 }}
                  </text>
                  <text style="color: #43c900;" v-if="orderdest.depositWay==0">到店验证成功后免收
                  </text>
                  <text v-else>可退
                  </text>
                </uni-td>
              </uni-tr>
            </uni-table>
            <!-- <view class="text" style="font-size: 24upx;"> -->
            <!-- 如果你放弃或不能免押，你也可以取车时支付押金 -->
            <!-- </view> -->
          </view>
        </view>
        <view class="content" style="padding: 0 20upx 40upx 30upx;" v-else-if="popuptext=='取消政策'">
          <!-- 取消政策暂未开发 -->
          <view class="content">
            <!-- <view class="tit">
              取消政策
            </view> -->
            <view class="table">
              <uni-table stripe emptyText="暂无更多数据" border>
                <uni-tr>
                  <uni-th align="center">取消时间</uni-th>
                  <uni-th align="center">扣费标准</uni-th>
                </uni-tr>
                <uni-tr>
                  <uni-td>提交订单15分钟内</uni-td>
                  <uni-td>免费取消</uni-td>
                </uni-tr>

                <uni-tr>
                  <uni-td>
                    <view class="">
                      提交订单15分钟后至{{ orderdest.bookStartTime }}
                      <view class="">
                        提交订单15分钟后-取车时间
                      </view>
                    </view>
                  </uni-td>
                  <uni-td>取消违约金30%</uni-td>
                </uni-tr>
              </uni-table>
            </view>
            <view class="text" style="font-size: 24upx;">
              注:取消违约金的计算基数为订单的【租车费】、【基础服务费】、【送车上门服务费】之和，减去订单中已使用的优惠的金额。
            </view>
          </view>
        </view>
        <view class="content" style="padding: 0 20upx 40upx 30upx;" v-else-if="popuptext=='车辆详情'">
          <!-- 车辆详情暂未开发 -->
          <scroll-view scroll-y="true" style="height: 700upx;">
            <view>
              <view class="title">
                车辆基本信息
              </view>
              <view class="xinhao">
                <view v-if="orderdest.vehicleParams"
                      style="border-bottom: 2upx solid #ddd;padding-bottom: 15upx;margin-bottom: 30upx;">
                  <text class="" v-for="(item,index) in orderdest.vehicleParams" :key="index" v-if="item">
                    {{ item }}
                    <text style="margin: 0 10upx;"
                          v-if="index !== orderdest.vehicleParams.length - 1 && orderdest.vehicleParams[index + 1] !== null">
                      /
                    </text>
                  </text>
                </view>
              </view>

              <scroll-view class="scroll-view_H" style="white-space: nowrap;
							width: 100%;" scroll-x="true" scroll-left="120">
                <!--  <image style="margin: 0 10upx; width: 600upx; height: 400upx; border-radius: 10upx;"
                       @tap="previewImagefun(index,orderdest.carpics.split(','))"
                       v-for="(item ,index) in orderdest.carpics.split(',')" :key="index"
                       :src="imgurl+item" mode=""></image> -->
                <ImagePreview
                    style="display: inline-block; margin: 0 10upx; width: 600upx; height: 400upx; border-radius: 10upx;"
                    v-for="(item ,index) in orderdest.carpic.split(',')" :key="index" :image="item"
                    :index="index" :url="imgurl" :classstyle="'width:100%;height:100%'"
                    :imagelist="orderdest.carpic.split(',')">
                </ImagePreview>
              </scroll-view>
              <view class="miaoshu" style="margin-top: 40upx;">
                <view class="title">车辆描述</view>
                <view class="img" style="margin-top: 30upx;">
                  <ImagePreview :image="orderdest.vehDrivingPic" :url="imgurl"></ImagePreview>
                  <!-- <image :src="imgurl+orderdest.vehDrivingPic" lazy-load mode=""></image> -->
                  <ImagePreview :image="orderdest.vehCheckPic" :url="imgurl"></ImagePreview>
                  <!-- <image :src="imgurl+orderdest.vehCheckPic" lazy-load mode=""></image> -->
                  <ImagePreview :image="orderdest.vehInsurancePic" :url="imgurl"></ImagePreview>
                  <!-- <image :src="imgurl+orderdest.vehInsurancePic" lazy-load mode=""></image> -->
                </view>

              </view>


            </view>
          </scroll-view>

          <!-- <scroll-view scroll-x="true" scroll-left="120">
            <view style="display: flex;width: 95%;margin: 0 auto;overflow: hidden;">
              <image style="width: 70%;"  v-for="(item ,index) in orderdest.carpics.split(',')"
                :key="index" :src="imgurl+item" mode=""></image>
            </view>
          </scroll-view> -->
        </view>
      </view>

    </uni-popup>

    <uni-popup ref="xzpopup" type="top" background-color="reba(0,0,0,0)">
      <view class="popup-content feiyongmingxi">
        <view class="content">
          <view class="fybox">
            <view class="feiyong">
              <text class="title">车辆租金合计</text>
              <text class="price">￥{{ xuzuobj.hjzujin }}</text>
            </view>
          </view>
          <view class="fybox">
            <view class="feiyong">
              <text class="title">基础服务费</text>
              <text class="price">￥{{ xuzuobj.jichufwfei }}</text>
            </view>
            <!-- <view class="feiyong">
              <view class="">
                <view class="title">
                  车辆手续费
                </view>
                <view class="text" style="font-size: 24upx; color: #999">
                  用于车辆清洁、车辆保养、单据制作、人员服务
                </view>
              </view>
              <text class="price">￥{{xuzuobj.shouxufei}}</text>
            </view> -->
            <view class="feiyong" v-if="checkboxfillednum==1">
              <text class="title">尊享服务费</text>
              <text class="price">￥{{ xuzuobj.zunxiangfywufei }}</text>
            </view>

          </view>
          <view class="fybox">
            <view class="feiyong">
              <text class="title">全额费用</text>
              <view class="price">
                <view class="redprice">
                  ￥{{ xuzuobj.zjnum }}
                </view>
                <view class="">
                  在线支付
                </view>
              </view>
            </view>

          </view>
        </view>
        <view class="" style="display: flex;justify-content: space-between;align-items: center;">
          <view class="">
            <view class="flex-x-center">
              续租天数：
              <uni-number-box v-model="xuzuobj.xuzutianshu" @change="changeValue"/>
            </view>
            <view class="" v-if="xuzuobj.startTime&&xuzuobj.endTime"
                  style="font-size: 26upx;font-weight: 700;line-height: 45upx;">
              <view class="">
                起始时间：{{ xuzuobj.startTime }}
              </view>
              <view class="">
                结束时间：{{ xuzuobj.endTime }}
              </view>
            </view>
          </view>

          <button class="" @tap="xuzuzhifu" :disabled="xuzuobj.xuzutianshu<1">
            去支付
          </button>
        </view>

      </view>
    </uni-popup>

    <uni-popup ref="xzjlpopup" type="right" background-color="rgba(0,0,0,0)">
      <view class="popup-content" style="border-radius: 0 ; height: 100%;">
        <view class="" style="border: 1upx solid #eee;padding: 30upx 0;text-align: center;">
          续租记录
        </view>
        <scroll-view scroll-y="true" style="height: 80%;">
          <view>
            <view class="" v-for="item in orderXzList" :key="item.id" v-if="item.status!='CANCEL_ORDERS'"
                  style="margin-bottom: 25upx;border-bottom: 1upx solid #eee;padding: 30upx;">
              <view class="" style="font-weight: 700;
						font-size: 28rpx;margin-bottom: 10upx;">
                {{ item.startTime }}-{{ item.endTime }}共{{ item.day }}天
              </view>

              <view class="" style="font-size: 26upx; text-align: right;">
                在线支付
                <text style="color: red;font-size: 34upx;">￥{{ item.totalMoney }}</text>
              </view>
            </view>
          </view>
        </scroll-view>
      </view>
    </uni-popup>
    <uni-popup ref="huanchepopup" type="bottom" background-color="rgba(0,0,0,0)">
      <view class="popup-content" style="border-radius: 0 ; height: 100%;">
        <view class="tabtop">

          <uni-icons type="closeempty" size="20" style="" @tap="$refs.huanchepopup.close()"></uni-icons>

          <view class="tit">
            选择提前还车时间/位置
          </view>
        </view>
        <view class="content" style="padding: 0 20upx 40upx 30upx;">

          <!-- <view class="" style="font-size: 30upx;font-weight: 700;">
            选择提前还车时间/位置
          </view> -->
          <view class="">
            <uni-section :title="'还车时间：' + huanchetime" type="line"></uni-section>
            <view class="example-body">
              <uni-datetime-picker :start="minDate" :end="orderdest.endTime" type="datetime"
                                   v-model="huanchetime"/>
            </view>
            <view>
              <block>
                <uni-section v-if="huancheaddres" :title="'还车地址：'"
                             type="line"></uni-section>
                <uni-section v-else title="还车地址：" type="line"></uni-section>
                <!-- {{JSON.parse(huancheaddres)[0]}} -->
              </block>

              <uni-data-checkbox v-model="activeAddressType" @change="checkboxfun"
                                 :localdata="gettypelist"/>

              <view class="shijianaddres">
                <view class="sjleft">
                  <view class="shijian">
                    <text class="tit">
                      还车地址：
                      <text class="addres">{{ huancheaddres }}</text>
                    </text>
                  </view>
                </view>
              </view>
            </view>

          </view>
          <view class="" style="margin-top: 40upx;">
            <button class="" type="primary" @tap="subhuanche">
              确认还车
            </button>
          </view>
        </view>


      </view>
    </uni-popup>
    <uni-popup ref="alertDialog" type="dialog">
      <uni-popup-dialog type="warn" cancelText="延后" confirmText="同意" title="合同签署"
                        content="当前订单有一份合同待签署,是否进行签署!" @confirm="dialogConfirm"
                        @close="dialogClose"></uni-popup-dialog>
    </uni-popup>

  </view>
</template>

<script>
import {getViolationList} from "@/utils/api/basics";
import {getordervehorder, getordervehorderlist} from '../../utils/new_file.js'
import orderdetailsskeleton from './orderdetailsskeleton/orderdetailsskeleton.vue'
import {cancelOrder, payOrder} from "../../utils/api/basics";
import {changeAddress, continuedOrder, createSignContractUrl, returnCar} from "../../utils/api/order";
import {txAppId} from "@/utils/config";

var app = getApp()

export default {
  components: {
    orderdetailsskeleton
  },
  // computed:{
  // 	useinfo:function(){
  // 		return uni.getStorageSync('useinfo')
  // 	}
  // },
  data() {
    let userinfo = uni.getStorageSync('useinfo')
    return {
      activeAddressType: 1,
      gettypelist: [{
        text: '门店自取',
        value: 1
      }, {
        text: '送车上门',
        value: 2
      }],
      useinfo: userinfo,
      current: 0,
      info: [],
      orderXzList: [],
      dotsStyles: {
        backgroundColor: 'rgba(0, 0, 0, .3)',
        border: '1px rgba(0, 0, 0, .3) solid',
        color: '#fff',
        selectedBackgroundColor: 'rgba(0, 0, 0, .9)',
        selectedBorder: '1px rgba(0, 0, 0, .9) solid'
      },
      violationInfo: undefined,
      orderdest: {},
      orderNum: 0,
      // userinfolable: '',
      imgurl: '',
      // orderTimer:null
      timeLeft: '',//待支付时倒计时
      endTime: null,
      // orderStatus: 'pending', // 初始状态为待支付
      timerInterval: null,//倒计时定时器
      popuptext: '',
      xuzuobj: {//续租对象
        xuzutianshu: 0, //续租天数
        hjzujin: 0, //合计租金
        // shouxufei: 0,
        jichufwfei: 0, //基础费
        zunxiangfywufei: 0, //尊享服务费
        zjnum: 0,  //总费用
        startTime: '',//开始时间
        endTime: ''//结束时间
      },
      xuzuobjcopy: {
        xuzutianshu: 0,
        hjzujin: 0,
        // shouxufei: 0,
        jichufwfei: 0,
        zunxiangfywufei: 0,
        zjnum: 0,
        startTime: '',
        endTime: ''
      },
      loading: false,
      huanchetime: '',//选择还车时间
      huancheaddres: '',//选择还车地址
      minDate: ''
    };
  },
  mounted() {
    const today = new Date();
    this.minDate = today.getFullYear() + '-' + (today.getMonth() + 1) + '-' + today.getDate() + ' ' + today
        .getHours() + ':' + today.getMinutes();
    console.log(this.minDate);
  },
  created() {
    this.imgurl = app.globalData.imgUrl
  },
  // 只执行一次，先于onshow
  onLoad(opt) {
    this.orderNum = opt.orderNum
    //this.initViolation()
  },
  // 每次跳转回来后刷新
  onShow() {
    console.log('popup', this.$refs.huanchepopup.showPopup)
    if (!this.$refs.huanchepopup.showPopup) {
      this.ordervehorderfun()
    }

  },
  onUnload() {
    var pages = getCurrentPages();
    var prevPage = pages[pages.length - 2];
    prevPage.$vm.reload
  },
  onPullDownRefresh() {
    this.ordervehorderfun(() => {
      uni.stopPullDownRefresh()
    })
    //this.initViolation()
  },
  methods: {
    checkboxfun(e) {
      let waht = this
      if (e.detail.value == 2) {
        app.confirm('选择送车地址', () => {
          uni.chooseLocation({
            success: res => {
              waht.orderdest.returnAddress = res.address
              waht.orderdest.returnLatLng = `${res.latitude},${res.longitude}`
              waht.huancheaddres = res.address
            },
            fail(res) {
              console.log(res);
              waht.gettype = 1
              waht.inputvalue2 = null
              app.toastnone('已取消送车上门')
              // console.log(waht.gettype);

            }
          });
        }, () => {
          this.gettype = 1
        })
      } else {
        waht.orderdest.returnAddress = null
        waht.orderdest.returnLatLng = null
        waht.huancheaddres = waht.orderdest.shopAddress
      }
    },
    //跳转签署小程序
    jumpPending() {
      createSignContractUrl(this.orderdest).then(res => {
        if (res.data.code == 200) {
          console.log(res.data.data)
          wx.navigateToMiniProgram({
            appId: txAppId,
            path: res.data.data.signUrl
          })
        }
      })
    },
    initiateContract() {
      this.$refs.alertDialog.open()
    },
    dialogClose() {
      this.$refs.alertDialog.close()
    },
    dialogConfirm() {
      if (this.orderdest.txFlowStatus) {
        // 签署合同直接跳转签署界面
        this.jumpPending()
      } else {
        // 跳转生成界面
        this.jumpInitContract()
      }
    },
    jumpInitContract() {
      uni.navigateTo({
        url: `/pagesB/orderdetails/initiateContract?orderNum=${this.orderdest.orderNum}`
      })
    },
    toCheckCode() {
      uni.navigateTo({
        url: `/pagesA/identificationCode/identificationCode?orderNum=${this.orderdest.orderNum}`
      })
    },
    ordervehorderfun(back) {
      this.loading = true
      getordervehorder(this.orderNum).then(data => {
        if (data.data.code == 200) {
          this.orderdest = data.data.data
          if (this.orderdest.returnAddress && this.orderdest.returnAddress.length > 1) {
            this.activeAddressType = 2
            this.huancheaddres = this.orderdest.returnAddress
          } else {
            this.activeAddressType = 1
            this.huancheaddres = this.orderdest.shopAddress
          }
          this.loading = false
          if (!['CONFIRM_COMPLETION', 'CANCEL_ORDERS', 'REJECT_ORDERS', 'CREATE_ORDER', 'GENERATE_ORDER'].includes(this.orderdest.status) && ['PART', 'PENDING', 'INIT', null].includes(this.orderdest.txFlowStatus)) {
            this.initiateContract()
          }
          this.startOrderTimer()
        }
      }).finally(() => {
        if (back != undefined) {
          back()
        }
      })
    },
    initViolation() {
      let query = {
        ordernum: this.orderdest.ordernum,
        status: 2
      }
      this.violationInfo = undefined
      getViolationList(query).then(res => {
        if (res.data.code == 200 && res.data.total > 0) {

          this.violationInfo = res.data.data.rows
        }
      })
    },
    async subimtorder() {
      let what = this

      uni.showModal({
        title: '提示',
        content: '是否支付该订单',
        success: async (res) => {
          if (res.confirm) {
            uni.showToast({
              title: '正在提交支付',
              icon: 'loading',
              success() {

              }
            })

            let orderdestobj = what.orderdest
            orderdestobj.openId = this.useinfo.openid
            payOrder(orderdestobj).then(zhifu => {
              uni.requestPayment({
                appId: zhifu.data.data.appid,
                timeStamp: zhifu.data.data.timeStamp, // 时间戳（单位：秒）
                nonceStr: zhifu.data.data.nonceStr, // 随机字符串
                signType: zhifu.data.data.signType,
                package: zhifu.data.data.package,
                paySign: zhifu.data.data.paySign,

                success: async (res) => {
                  uni.showLoading({title: "支付中"})
                  clearInterval(this.timerInterval);
                  setTimeout(() => {
                    this.ordervehorderfun(() => {
                      if (this.orderdest.status == 'PAYMENT_ORDER') {
                        uni.showToast({
                          title: '支付成功',
                          icon: 'success',
                        })
                        this.$refs.alertDialog.open()
                      } else {
                        uni.showToast({
                          title: '请联系管理人员，查询问题',
                          icon: 'error',
                        })
                      }
                    })
                  }, 2000)
                },
                fail: function (e) {
                  console.log(e);
                }

              })
            })


            // let zhifu = await postordervehorder(orderdestobj)
            // console.log(zhifu);
            // if (zhifu.data.code == 200) {
            //
            //   uni.requestPayment({
            //     appId: zhifu.data.data.appid,
            //     timeStamp: zhifu.data.data.timeStamp, // 时间戳（单位：秒）
            //     nonceStr: zhifu.data.data.nonceStr, // 随机字符串
            //
            //     signType: zhifu.data.data.signType,
            //     package: zhifu.data.data.package,
            //     paySign: zhifu.data.data.paySign,
            //
            //     success: async function (res) {
            //       console.log(res);
            //       uni.showToast({
            //         title: '支付成功',
            //         icon: 'success',
            //         success() {
            //
            //         }
            //       })
            //       let putorderobj = orderdestobj
            //
            //       // putorderobj.id = data.data.orderId
            //       putorderobj.status = 2
            //       putorderobj.ispay = 1
            //       putorderobj.paytime = new Date()
            //
            //       let putorder = await putordervehorder(putorderobj)
            //
            //       console.log(putorder);
            //       what.ordervehorderfun()
            //       // uni.navigateTo({
            //       // 	url: '/pagesB/orderdetails/orderdetails?orderId=' +
            //       // 		data.data.orderId
            //       // })
            //     },
            //     fail: function (e) {
            //       console.log(e);
            //     }
            //
            //   })
            // }


          } else if (res.cancel) {
            console.log('用户点击取消');
          }
        }
      });


    },
    async quxiaoorder() {
      let what = this
      uni.showModal({
        title: '提示',
        content: '是否取消该订单',
        success: async function (res) {

          if (res.confirm) {
            // 修改车辆状态，使车辆占用
            cancelOrder(what.orderdest.orderNum).then(res => {
              what.ordervehorderfun()
            })
          } else if (res.cancel) {
            console.log('用户点击取消');
          }
        }
      })
    },
    checkIDCard() {
      let useinfo = uni.getStorageSync('useinfo')
      if (useinfo.isCertified == 0) {
        uni.showToast({
          title: '请先实名',
          icon: 'none',
          success() {
            setTimeout(() => {
              uni.navigateTo({
                url: '/pagesB/shiming/shiming'
              });
            }, 2000);
          }
        })

      }
      return useinfo.isCertified != 0

    },
    huanche() {
      this.$refs.huanchepopup.open()

    },
    getaddress() {
      let that = this
      uni.chooseLocation({
        success(res) {
          that.huancheaddres = JSON.stringify([res.address, res.latitude,
            res.longitude
          ]);
        },
        fail(res) {
          console.log(res);

          app.toastnone('已取消还车地址')


        }
      })
    },
    subhuanche() {
      let that = this
      app.confirm('是否提交提前还车信息', function () {
        if (that.orderdest.pickUpMode == 2) {
          if (that.huancheaddres && that.huanchetime) {
            let putorderobj = that.orderdest
            putorderobj.endTime = that.huanchetime
            putorderobj.returnAddress = that.huancheaddres;
            // putorderobj.beforeReturnTime = that.huanchetime
            // putorderobj.status = 7
            returnCar(putorderobj).then(putorder => {
              console.log(putorder);
              that.$refs.huanchepopup.close()
              that.ordervehorderfun()
            })
          } else {
            app.toastnone('请选择时间和地址')
          }
        } else if (that.orderdest.pickUpMode == 1) {
          if (that.huanchetime) {
            let putorderobj = that.orderdest
            putorderobj.endTime = that.huanchetime
            // putorderobj.beforeReturnTime = that.huanchetime
            // putorderobj.status = 7
            returnCar(putorderobj).then(putorder => {
              console.log(putorder);
              that.$refs.huanchepopup.close()
              that.ordervehorderfun()
            })
          } else {
            app.toastnone('请选择时间')
          }
        }


      })

    },
    chakanxuzu() {
      getordervehorderlist({
        wid: this.useinfo.id,
        status: 'CONTINUED_ORDER',
        pageSize: 500,
        pageNum: 1
      }).then(data => {
        if (data.data.code == 200) {
          this.orderXzList = data.data.rows
          this.$refs.xzjlpopup.open()
        }
      })

    },
    async xuzu() {
      // let xuzuflag = this.orderdest.xzOrderList.some(item => item.status == 1)
      // console.log(xuzuflag);
      if (this.orderdest.openXz == 1) {
        this.$refs.xzpopup.open()
      } else if (this.orderdest.openXz == 2) {
        app.toastnone('该车辆不支持续租')
      }

    },
    changeValue(value) {
      console.log('返回数值：', value);
      //console.log(shaixuanxuzu);

      this.xuzuobj.hjzujin = this.orderdest.money * value
      // this.xuzuobj.shouxufei = this.orderdest.fee
      this.xuzuobj.jichufwfei = this.orderdest.serviceFee
      this.xuzuobj.zunxiangfywufei = this.orderdest.zxServiceFee
      this.xuzuobj.xuzutianshu = value


      // this.xuzuobj.startTime = shaixuanxuzu.length != 0 ? shaixuanxuzu[0].endTime : this
      //     .orderdest.endTime

      // 创建一个表示 2024 年 5 月 11 日 11:00 的 Date 对象
      // var startDate = new Date(shaixuanxuzu.length != 0 ? shaixuanxuzu[0].endTime : this
      //     .orderdest.endTime);

      // 计算 5 天后的时间
      let startDate = new Date(this.orderdest.endTime)
      startDate.setDate(startDate.getDate() + value)

      // 格式化日期
      var formattedDate = startDate.getFullYear() + '-' +
          ('0' + (startDate.getMonth() + 1)).slice(-2) + '-' +
          ('0' + startDate.getDate()).slice(-2) + ' '
          +
          ('0' + startDate.getHours()).slice(-2) + ':' +
          ('0' + startDate.getMinutes()).slice(-2);


      this.xuzuobj.endTime = formattedDate
      this.xuzuobj.startTime = this.orderdest.endTime
      this.xuzuobj.zjnum = this.xuzuobj.hjzujin + this.xuzuobj.jichufwfei + this.xuzuobj
          .zunxiangfywufei
      if (this.orderdest.pickUpMode == 2) {
        this.xuzuobj.zjnum = (Number(this.xuzuobj.zjnum) + this.orderdest.sendServiceFee).toFixed(2)
      }
    },
    async xuzuzhifu() {
      let what = this
      // 取消订单和订单唤起支付
      // 待支付的的订单设置默认半小时自动取消
      // 人脸识别身份证识别 微信群问api
      uni.showToast({
        title: '正在提交支付',
        icon: 'loading',
        success() {

        }
      })

      let orderdestobj = {
        ...what.orderdest
      }

      orderdestobj.openid = what.useinfo.openid
      orderdestobj.xzday = what.xuzuobj.xuzutianshu
      orderdestobj.day = what.xuzuobj.xuzutianshu
      orderdestobj.totalMoney = what.xuzuobj.zjnum
      // orderdestobj.prepayMoney = what.xuzuobj.zjnum
      // orderdestobj.totalMoney = what.xuzuobj.zjnum
      orderdestobj.startTime = what.xuzuobj.startTime
      orderdestobj.originOrderNum = what.orderdest.ordernum
      orderdestobj.endTime = what.xuzuobj.endTime


      let data = await continuedOrder(orderdestobj)
      console.log(data);
      if (data.data.code == 200) {
        let objss = {
          appId: data.data.data.appid,
          timeStamp: data.data.timeStamp, // 时间戳（单位：秒）
          nonceStr: data.data.nonceStr, // 随机字符串
          package: data.data.package,
          signType: data.data.signType,
          paySign: data.data.paySign,
        } //签名}
        console.log('支付', objss);
        uni.requestPayment({
          appId: data.data.data.appid,
          timeStamp: data.data.data.timeStamp, // 时间戳（单位：秒）
          nonceStr: data.data.data.nonceStr, // 随机字符串
          signType: data.data.data.signType,
          package: data.data.data.package,
          paySign: data.data.data.paySign,
          success: async function (res) {
            console.log(res);
            uni.showToast({
              title: '支付成功',
              icon: 'success',
              success() {

              }
            })

            let putorderobj = what.orderdest
            putorderobj.iszx = 1
            what.ordervehorderfun()
            what.$refs.xzpopup.close()
            // 清空对象的所有属性值
            what.xuzuobj = what.xuzuobjcopy
          },
          fail: async function (e) {
            console.log(e, '支付失败');
            // 续租取消支付把续租订单改成未支付
            let xzputorderobj = getdata.data.data
            xzputorderobj.status = 'CANCEL_ORDERS'
            // putorderobj.ispay = 1
            // putorderobj.paytime = new Date()

            // let putorder = await putordervehorder(
            //     xzputorderobj)
            console.log(putorder);
            // uni.navigateTo({
            // 	url: '/pagesB/orderdetails/orderdetails?orderId=' +
            // 		data.data.orderId
            // })
            what.$refs.xzpopup.close()
            what.ordervehorderfun()
            // 清空对象的所有属性值
            what.xuzuobj = what.xuzuobjcopy
          }
        })
      }

    },
    async startOrderTimer() {
      console.log(this.orderdest);
      // 清除旧的定时器
      if (this.timerInterval) {
        clearInterval(this.timerInterval);
      }
      if (['GENERATE_ORDER', 'CREATE_ORDER'].includes(this.orderdest.status)) {
        let duration = 10 * 60 * 1000; // 3分钟
        // 保证下单时间字符串正确解析为Date对象
        const orderTimeString = this.orderdest.createTime; // 例如 "2024-04-17 11:46"
        const orderTime = new Date(orderTimeString); // 增加秒和毫秒部分
        console.log(orderTime);
        this.endTime = new Date(orderTime.getTime() + duration);

        console.log(this.endTime);


        // 启动新的定时器
        this.timerInterval = setInterval(() => {
          const now = new Date();
          if (now >= this.endTime) {
            clearInterval(this.timerInterval);
            //this.ordervehorderfun()
            this.timeLeft = '';

            // let putorderobj = this.orderdest
            // putorderobj.status = 'CANCEL_ORDERS'
            // putordervehorder(putorderobj)

            cancelOrder(this.orderdest.orderNum).then(res => {
              this.ordervehorderfun()
            })
            app.toastnone('订单已自动取消');
          } else {
            const secondsLeft = Math.round((this.endTime - now) / 1000);
            const minutesTotal = Math.floor(secondsLeft / 60);
            const hours = Math.floor(minutesTotal / 60)
            const minutes = Math.floor(minutesTotal % 60)
            const seconds = secondsLeft % 60;
            this.timeLeft = `${hours}:${minutes < 10 ? '0' + minutes : minutes}:${seconds < 10 ? '0' + seconds : seconds}`;
          }
        }, 1000);
      }
    },
    cop() {
      uni.setClipboardData({
        data: this.orderdest.ordernum,
        success: function () {
          app.toastnone('订单号已复制');
        },
        fail: err => {
          console.log(err)
        }
      });
    },
    tappopupfun(text) {
      this.popuptext = text
      this.$refs.tappopup.open()
    },

    lianxiphone(phone) {
      console.log(phone);
      // 在某个事件处理函数中调用拨号功能
      uni.makePhoneCall({
        phoneNumber: phone, // 要拨打的电话号码
        success: function () {
          console.log('拨号成功');
        },
        fail: function (error) {
          console.error('拨号失败', error);
        },
      })
    },
    getaddres(arr, lat, lng) {

      uni.openLocation({
        name: arr,
        latitude: Number(lat),
        longitude: Number(lng),
        scale: 13,
        success: res => {
          console.log(res)
        }, fail: err => {
          console.log(err)
        }
      })
    },
    getmendianaddres(type) {
      // let pickUpAddress = JSON.parse(arr)
      let what = this
      console.log(this.orderdest.shopAddress, this.orderdest.pickUpLatLng);
      let latlng = this.orderdest.pickUpLatLng.split(',')
      uni.chooseLocation({
        name: what.orderdest.shopAddress,
        latitude: Number(latlng[0]),
        longitude: Number(latlng[1]),

        scale: 13,
        success: (res) => {
          console.log(res)
          if (res.errMsg == 'chooseLocation:ok') {

            this.orderdest.pickUpAddress = res.address
            this.orderdest.pickUpLatLng = `${res.latitude},${res.longitude}`
            changeAddress({
              orderNum: this.orderdest.orderNum,
              type: type,
              address: this.orderdest.pickUpAddress,
              latLng: this.orderdest.pickUpLatLng,
            }).then(response => {
              if (response.data.code == 200) {
                this.orderdest = response.data.data
              }
            })
          }
        }
      })
    },
    // previewImagefun(index, imglist) {
    // 	getApp().previewImage(index, imglist)
    // },
    flitertext(idNumber, x, y) {
      if (idNumber) {
        const idArray = idNumber.split('');

        // 遍历需要隐藏的范围，将其中的数字替换为 *
        for (let i = x; i < idArray.length - y; i++) {
          idArray[i] = '*';
        }
        // console.log(idArray);
        // 将数组重新拼接成字符串，并返回
        return idArray.join('');
      }
    },
  }
}
</script>

<style lang="less">
button {
  margin-left: 15upx;
  width: 150upx;
  height: 70upx;
  line-height: 70upx;
  text-align: center;
  font-size: 26upx;
  padding: 0;
}

.title {
  font-weight: 700;
  font-size: 30rpx;
}

.conte,
.content {
  position: relative;

  .xinhao {
    margin-top: 20upx;
    font-size: 26upx;

    text {
      color: #999;
    }
  }

}

.statebox {
  background: linear-gradient(to right, #46a9ff, #0055ff);
  color: #fff;
  padding: 35upx;
  padding-bottom: 50upx;

  .state {
    font-size: 45upx;
    font-weight: 700;
  }

  .text {
    font-size: 24upx;
    margin-top: 20upx;
  }
}

.border-radius20 {
  margin-top: -30upx;
  overflow: hidden;
  border-top-left-radius: 30upx;
  border-top-right-radius: 30upx;
}

.popper-lanse {
  font-size: 24upx;
  color: #3366CC;
  float: right;
}

.backcolor-white {
  background-color: white;
  margin-bottom: 15upx;
  padding: 0 35upx;

  .contenitem {
    padding: 35upx 0;
    border-bottom: 3upx solid #eee;


    /* 取消最后一个view的边框 */

    &:last-child {
      border: none;
    }


    .imglog {
      width: 180upx;
      // height: 50upx;
      margin-right: 15upx;
      display: flex;
      align-items: center;
    }


    .top {
      display: flex;
      justify-content: space-between;


      .fl {
        font-size: 30upx;
        font-weight: 700;

        text {
          margin-left: 10upx;
          color: orangered;
        }
      }


    }

    .db {
      margin-top: 20upx;
      font-size: 24upx;


    }

    .time {
      font-weight: 700;
      font-size: 28upx;
    }

    .addres-box {
      font-size: 24upx;

      view {
        // margin-top: 10upx;
        //line-height: 40upx;
      }
    }

    .jiashiyuan {
      font-size: 30upx;
      font-weight: 700;
    }

    .jiashiyuanbox {
      view {
        display: flex;
        font-size: 26upx;
        margin-top: 10upx;
        align-items: center;

        .label {
          width: 20%;
          text-align: left;
          margin-right: 30upx;
        }

        .text {
          text-align: left;
        }
      }
    }
  }

  .jiashiyuantext {
    font-size: 24upx;
    padding: 20upx 0;
  }

  .zhifuquxiao,
  .kaishishiyong,
  .quchehou {
    display: flex;
    padding: 20upx 0;
    float: right;
    font-size: 24upx;

    .fl {
      font-weight: 700;
      font-size: 28upx;
      margin-bottom: 15upx;
    }

    .zhifu {
      color: white;
      background: linear-gradient(to right, #FF9900 0%, #FF6600 100%);
    }


    .kaishi {
      border: 1upx solid #409eff;
      color: #fff;
      background-color: #409eff;
    }


  }

  .sfzjiashizheng {
    padding-bottom: 50upx;
    margin-bottom: 50upx;

    .images {
      display: flex;

      image {
        // width: 300upx;
        // height: auto;
        margin: 0 15upx;
      }
    }

    .bc {
      // position: absolute;
      // bottom: 20upx;
      // right: 20upx;
      border: 1upx solid #409eff;
      color: #fff;
      background-color: #409eff;
      margin-top: 30upx;
    }

    .file-picker-box {
    }
  }
}

.quxiao {
  color: #0055ff;
  background-color: white;
}

.popup-content {
  background-color: #fff;

  .tabtop {
    display: flex;
    align-items: center;
    padding: 15upx 30upx 50upx 30upx;

    .tit {
      font-weight: 700;
      flex: 1;
      text-align: center;
    }
  }

  .content {
    .text {
      color: #999;
      font-size: 24upx;
      margin-top: 10upx;
    }

    .fyitem {
      margin: 20upx 0;

      .title {
        font-size: 30upx;
      }

      .fy {
        margin-top: 20upx;
        display: flex;
        justify-content: space-between;
        font-size: 26upx;
        color: #333;
      }
    }

    .fyitemdb {

      text-align: right;
      border-top: 1upx solid #ccc;
      padding: 20upx 0;

      .ddje {
        font-size: 30upx;
      }
    }
  }

  .miaoshu {
    width: 100%;

    .img {
      width: 100%;

      image {
        width: 100%;
      }
    }
  }
}

.feiyongmingxi {
  background-color: #FFf;
  border-radius: 0;
  padding: 0 40upx;

  button {
    float: right;
    margin: 40upx 0;
    background-color: #007aff;
    color: #fff;
    font-size: 28upx;
    width: 160upx;
    height: 70upx;
    line-height: 70upx;
  }

  .content {
    .fybox {
      border-bottom: 1upx solid #eee;
      padding: 15upx 0;

      .feiyong {
        // line-height: 50upx;
        margin: 20upx 0;
        display: flex;
        justify-content: space-between;

        .title {
          font-weight: 700;
        }

        .price {
          text-align: right;
          font-size: 30upx;

          .redprice {
            color: red;
            font-size: 46upx;
          }
        }
      }
    }


  }

}

.violation {
  width: 300rpx;
  height: 300rpx;
  display: inline-block;
}

.shanchu {
  text-decoration: line-through;
  color: red;
}

.jump-text {
  float: right;
  margin-right: 50upx;
  color: #3366CC
}

.weixinzhifu {
  color: #FFFFFF;
  width: 90vw;
  margin: 20rpx auto;
  height: 80rpx;
  line-height: 80rpx;
}

.flex-box-address {
  margin-top: 10rpx;
  min-height: 40upx;
  font-size: 28rpx;
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;

  .address-box {
    width: 58vw;
  }

  .float-right-address {
    margin-left: 4vw;
  }

  .circle {
    width: 15upx;
    height: 15upx;
    border-radius: 50%;
    margin-top: 10rpx
  }

  view {
    word-wrap: break-word; /* 允许在长单词内部换行 */
    word-break: break-all; /* 允许在任意位置换行 */
    height: auto;
  }
}

.shijianaddres {
  // display: flex;
  // align-items: center;
  // justify-content: space-between;
  font-size: 34upx;
  position: relative;

  .sjcent {
    text-align: center;
    line-height: 15upx;
    font-size: 24upx;
    margin: 20upx 0;
    color: #007aff;

    image {
      width: 70upx;
      height: 10upx;
    }
  }

  .sjright {
    margin-top: 30upx;
  }

  .addres {
    color: black;
    // width: 100%;
    // white-space: pre-wrap;
    // overflow: hidden;
    // font-size: 26upx;
    // height: 40upx;
  }


  .shijian {
    font-weight: 700;
    margin: 5upx 0;
  }

}
</style>